import request from '../utils/request';

export async function userSearch({page = 1, page_size = 10}) {
  return request('/api/user/search?page=' + page + '&page_size=' + page_size + '&debug=1');
}

export async function userDetail({id}) {
  return request('/api/user/detail?id=' + id + "&debug=1");
}

export async function ruleSearch(id) {
  return request('/api/user/rules?id=' + id);
}

export async function saveUserInfo(query) {
  var form = new FormData;

  form.append('mobile', query.mobile);
  form.append('email', query.email);
  form.append('username', query.username);
  form.append('password', query.password);
  form.append('realname', query.realname);
  form.append('sex', query.sex);
  form.append('id_card_number', query.id_card_number);
  form.append('origin_address', query.origin_address);
  form.append('live_address', query.live_address);
  form.append('education_info', query.education_info);

  return request('/api/user/modify?debug=1', {
    method: 'post',
    body: form
  });
}
